<section class="block">
	<h1 class="block-title">Lịch sử đơn hàng</h1>
	
	<div class="block-content">

<?php
if ( !empty($orders) ) {
	
	printf('<table class="table">');
	
	printf('<thead><tr>');
	printf('<th width="10%%">Mã ĐH</th>');
	printf('<th width="15%%">Ngày</th>');
	printf('<th width="10%%">Hình thức GD</th>');
	printf('<th>Các tựa sách</th>');
	printf('<th width="15%%">Giá trị ĐH</th>');
	printf('</tr></thead>');
	
	printf('<tbody>');
	foreach ($orders as $order) {
		printf('<tr>');
		
		printf('<td>#%s</td>', $order->order_id);
		printf('<td>%s</td>', formatLongDate($order->timestamp));
		printf('<td>%s</td>', 'Mua');
		
		if ( !empty($order->details) ) {
			$books = array();
			foreach ($order->details as $details) {
				if ( !empty($details->product) ) {
					$books[] = '&rsaquo; '.CHtml::link($details->product->description->name, $details->product->url, array('target' => '_blank'));
				}
			}
		}
		
		printf('<td>%s</td>', implode('<br />', $books));
		printf('<td>%s</td>', $this->renderPartial('//common/price', array('value' => $order->total), true));
		
		printf('</tr>');
	}
	printf('</tbody>');
	
	printf('</table>');
	
} ?>

	</div>
</section>